home *** CD-ROM | disk | FTP | other *** search
/ bioinformatics.org / bioinformatics.org_software.tar / www.bioinformatics.org / download / ecell2 / ecell220setup.exe / {app} / standard / STDR / DecayReactor.rd < prev    next >
Text File  |  2000-03-01  |  2KB  |  76 lines

  1. @CLASSNAME: DecayReactor
  2.  
  3. @BASECLASS: FluxReactor
  4. @AUTHOR: Kouichi Takahashi
  5. @EMAIL: shafi@sfc.keio.ac.jp
  6. @DATE: 29/6/1999
  7.  
  8. %VERSION: ecs-v08, 0.1
  9.  
  10. @BRIEF_DESCRIPTION: Disintegration or decay process.
  11. @DESCRIPTION:A reactor class for disintegration or decay processes.
  12. The quantity of the 'Substrate' is reduced according to the half-life inputted.
  13.  
  14. @EQUATION: $$S(t)=S(0)e^{-\frac{ln2}{T}t}$$
  15.  
  16. %SUBSTANCE: Substrate, 1, 1
  17. %SUBSTANCE: Product, Inf, 0
  18. %SUBSTANCE: Catalyst, 0, 0
  19. %SUBSTANCE: Effector, 0, 0
  20.  
  21. %PARAMETER: T, Float, , Half Time
  22.  
  23. @NOTES: MassActionReactor: $k = \frac{ln2}{T}$
  24.  
  25. %INCLUDE_FILE_C: stdio.h
  26.  
  27. @PRIVATE:
  28. Float k;
  29.  
  30. @INITIALIZE_FUNC:
  31.   if(T <= 0)
  32.     {
  33.       warning("0 or negative half time. set to 1."),condition(InitFail);
  34.       T = 1;
  35.     }
  36.  
  37.   k = log(2)/T;
  38.   if(numSubstrate() != 1)
  39.     {
  40.       warning("the number of substrate of DecayReactor must be one.");
  41.       condition(InitFail);
  42.     }
  43.  
  44.   for(int i = 0 ; i<numSubstrate() ; i++){
  45.     if(!substrate(i)->substance().haveConcentration())
  46.       {
  47.         char buf[50];
  48.         sprintf(buf,"Cannot calculate concentration of substrate [%s].",
  49.                 substrate(i)->substance().entryname().c_str());
  50.         warning(buf),condition(InitFail);
  51.       }
  52.   }
  53.  
  54. @REACT_FUNC:
  55.  
  56.   Float velocity = k * N_A;
  57.   velocity *= _substrateList[0]->substance().supersystem()->volume();
  58.  
  59.   int i = numSubstrate();
  60.   do{
  61.     --i;
  62.     // calculate velocity
  63.     int j = substrate(i)->coefficient();
  64.     do{
  65.       j--;
  66.       velocity *= substrate(i)->concentration();
  67.       } while(j != 0);
  68.   } while(i != 0);
  69.  
  70.  
  71.   // now we have change in number of molecules per second
  72.  
  73.   process(velocity);
  74.  
  75.  
  76.